package com.coder520.mamabike.utils;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;

/**
 * Created by ASUS on 2017/8/11.
 */
public class PropertiesUtil {
    private static Logger logger = LoggerFactory.getLogger(PropertiesUtil.class);

    private static Properties prop;

    static {
        String filename = "RSAinfo.properties";
        prop = new Properties();
        try {
            prop.load(new InputStreamReader(PropertiesUtil.class.getClassLoader().getResourceAsStream(filename)));
        } catch (IOException e) {
            logger.error("加载RSAinfo文件失败",e);
        }
    }

    public static String getProperty(String name) {
        if(StringUtils.isBlank(name)){
            return null;
        }
        return prop.get(name.trim()).toString().trim();
    }

}
